home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / a_man / cat7 / raw.z / raw
Encoding:
Text File  |  1998-10-20  |  5.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4. RRRRAAAAWWWW((((7777FFFF))))                                                                RRRRAAAAWWWW((((7777FFFF))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      raw - raw network protocol family
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<nnnneeeetttt////rrrraaaawwww....hhhh>>>>
  14.  
  15. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.      The Raw protocol family is a collection of input decapsulation protocols
  17.      layered atop the data link protocol of a network interface.  The Raw
  18.      family supports only the SOCK_RAW socket type.
  19.  
  20.    AAAAddddddddrrrreeeessssssssiiiinnnngggg
  21.      Sockets bound to the Raw protocol family use the following addressing
  22.      structure, defined in <_n_e_t/_r_a_w._h>:
  23.  
  24.           struct sockaddr_raw {
  25.                u_short        sr_family;
  26.                union {
  27.                    struct {
  28.                     u_short srl_port;
  29.                     char srl_ifname[RAW_IFNAMSIZ];
  30.                    } sru_local;
  31.                    struct {
  32.                     char srf_addr[RAW_MAXADDRLEN];
  33.                    } sru_foreign;
  34.                } sr_u;
  35.           };
  36.  
  37.           #define   sr_port        sr_u.sru_local.srl_port
  38.           #define   sr_ifname sr_u.sru_local.srl_ifname
  39.           #define   sr_addr        sr_u.sru_foreign.srf_addr
  40.  
  41.  
  42.      The address format differs between local and foreign usage.  A local
  43.      AF_RAW sockaddr contains a port, identifying the socket to which this
  44.      address is bound, and the zero-padded name of a network interface.  If
  45.      the address to bind contains a zeroed interface name, the primary
  46.      interface is used.  Port numbering depends on the protocol of the socket
  47.      being bound.  A foreign AF_RAW sockaddr contains a link-layer destination
  48.      address.
  49.  
  50.    PPPPrrrroooottttooooccccoooollllssss
  51.      There are two protocols in the Raw family, Snoop and Drain.  The Snoop
  52.      protocol captures link-layer packets which match a bitfield filter and
  53.      transports them to that filter's socket.  Snoop prepends a header
  54.      containing packet state, reception sequence number, and reception time.
  55.      The Drain protocol receives packets having network-layer type codes or
  56.      encapsulations not implemented by the kernel.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRAAAAWWWW((((7777FFFF))))                                                                RRRRAAAAWWWW((((7777FFFF))))
  71.  
  72.  
  73.  
  74.      Both protocols transmit packets with a link-layer header fetched from the
  75.      beginning of the user's _w_r_i_t_e(2) or _s_e_n_d(2) buffer.  They ignore any
  76.      destination address supplied to _s_e_n_d_t_o(2) or _c_o_n_n_e_c_t(2).  However,
  77.      connecting restricts input to packets originating from the foreign
  78.      (connected) address.
  79.  
  80.      On input, a protocol-specific header, the link-layer header, and packet
  81.      data are copied to the user's _r_e_a_d(2) or _r_e_c_v(2) buffer.  All raw domain
  82.      protocols guarantee that the offset of packet data from the beginning of
  83.      the user's buffer is congruent with RRRRAAAAWWWW____AAAALLLLIIIIGGGGNNNNGGGGRRRRAAAAIIIINNNN.  RRRRAAAAWWWW____HHHHDDDDRRRRPPPPAAAADDDD((((_h_d_r_s_i_z_e))))
  84.      yields the byte-padding needed to align packet data, given the link-layer
  85.      header's size in bytes.
  86.  
  87.      To gather Raw protocol family statistics, call _i_o_c_t_l(2) with a Snoop or
  88.      Drain socket, the SSSSIIIIOOOOCCCCRRRRAAAAWWWWSSSSTTTTAAAATTTTSSSS command, and the address of the following
  89.      structure, defined in <_n_e_t/_r_a_w._h>:
  90.  
  91.           struct rawstats {
  92.                struct snoopstats {
  93.                     u_long    ss_seq;
  94.                     u_long    ss_ifdrops;
  95.                     u_long    ss_sbdrops;
  96.                } rs_snoop;
  97.                struct drainstats {
  98.                     u_long    ds_ifdrops;
  99.                     u_long    ds_sbdrops;
  100.                } rs_drain;
  101.           };
  102.  
  103.  
  104.      The ssssssss____sssseeeeqqqq structure member tells the current Snoop sequence number,
  105.      which counts all packets received by the hardware, whether or not they
  106.      can be decapsulated.  The iiiiffffddddrrrrooooppppssss members tell how many packets were
  107.      dropped by the network interface due to resource shortages or hardware
  108.      errors.  The ssssbbbbddddrrrrooooppppssss members tell how many packets were decapsulated by
  109.      the network interface but dropped due to socket buffer limits.  See
  110.      _g_e_t_s_o_c_k_o_p_t(2) for information on socket buffer sizes and how to change
  111.      them.
  112.  
  113. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  114.      socket(2), snoop(7P), drain(7P)
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.